import request from 'utils/request'

// 获取分类列表
export function GetStoreCategoryTree(data) {
  return request({
    url: '/Store/GetStoreCategoryTree',
    method: 'post',
    data: data
  })
}

// 获取筛选列表
export function GetStoreTagList() {
  return request({
    url: '/Store/GetStoreTagList',
    method: 'post'
  })
}

// 获取商家分页
export function GetStorePage(data) {
  return request({
    url: '/Store/GetStorePage',
    method: 'post',
    data: data
  })
}
// 获取城市id
export function GetCityIdByCode(params) {
  return request({
    url: '/Store/GetCityIdByCode',
    method: 'post',
    params: params
  })
}
// 获取所属区域
export function GetUserCityId() {
  return request({
    url: '/Store/GetUserCityId',
    method: 'post'
  })
}
// 获取城市设置
export function GetCitySettingInfo() {
  return request({
    url: '/Store/GetCitySettingInfo',
    method: 'post'
  })
}
// 获取商家详情
export function GetStoreInfo(data) {
  return request({
    url: '/Store/GetStoreInfo',
    method: 'post',
    data: data
  })
}

// 获取商家介绍
export function getDescription(id) {
  return request({
    url: '/Store/GetDescription?id=' + id,
    method: 'post'
  })
}

// 商家入驻申请
export function storeApply(userId, model) {
  return request({
    url: '/Store/StoreApply',
    method: 'post',
    data: {
      UserId: userId,
      StoreName: model.storeName.value,
      Logo: model.logo.value,
      AdvertPictures: model.advertPictures.value.join(','),
      StoreExplain: model.storeExplain.value,
      ContactName: model.concactName.value,
      ContactTel: model.phone.value,
      ProvinceId: model.area.ProvinceId, // 省份
      ProvinceName: model.area.ProvinceName,
      CityId: model.area.CityId, // 城市
      CityName: model.area.CityName,
      AreaId: model.area.AreaId, // 区县
      AreaName: model.area.AreaName,
      ContactAddress: model.address.value,
      Lng: model.Lng.value,
      Lat: model.Lat.value,
      AddressDescription: model.addressDesc.value,
      BusinessHours: model.startTime.value + '-' + model.endTime.value,
      CategoryId: model.bussinessType.id,
      ShopPictures: model.shopPictures.value.join(','),
      Description: model.description.value,
      RecommendCode: model.referrer.value
    }
  })
}

// 获取商家首页个人信息
export function getUserInfo() {
  return request({
    url: '/Store/GetUserInfo',
    method: 'post'
  })
}

// 获取商家资料
export function getInfo() {
  return request({
    url: '/Store/GetInfo',
    method: 'post'
  })
}

// 更新商家资料
export function update(model) {
  return request({
    url: '/Store/Update',
    method: 'post',
    data: {
      StoreName: model.storeName.value,
      Logo: model.logo.value,
      AdvertPictures: model.advertPictures.value.join(','),
      StoreExplain: model.storeExplain.value,
      ContactName: model.concactName.value,
      ContactTel: model.phone.value,
      ProvinceId: model.area.ProvinceId, // 省份
      ProvinceName: model.area.ProvinceName,
      CityId: model.area.CityId, // 城市
      CityName: model.area.CityName,
      AreaId: model.area.AreaId, // 区县
      AreaName: model.area.AreaName,
      ContactAddress: model.address.value,
      Lng: model.Lng.value,
      Lat: model.Lat.value,
      AddressDescription: model.addressDesc.value,
      BusinessHours: model.startTime.value + '-' + model.endTime.value,
      CategoryId: model.bussinessType.id,
      ShopPictures: model.shopPictures.value.join(','),
      Description: model.description.value
    }
  })
}

// 获取收银二维码
export function GetCashQrCodeUrl(params) {
  return request({
    url: '/Store/GetCashQrCodeUrl',
    method: 'post',
    params: params
  })
}
// 获取收银小程序码
export function GetCashMpCodeUrl(params) {
  return request({
    url: '/Store/GetCashMpCodeUrl',
    method: 'post',
    params: params
  })
}

// 获取门店会员分页
export function GetStoreMemberPage(data) {
  return request({
    url: '/Store/GetStoreMemberPage',
    method: 'post',
    data: data
  })
}
// 获取门店会员信息
export function GetStoreMemberInfo(params) {
  return request({
    url: '/Store/GetStoreMemberInfo',
    method: 'post',
    params: params
  })
}

// 获取门店会员信息
export function GetStoreMemberAccount(params) {
  return request({
    url: '/Store/GetStoreMemberAccount',
    method: 'post',
    params: params
  })
}
// 获取门店会员统计
export function GetStoreMemberTotal() {
  return request({
    url: '/Store/GetStoreMemberTotal',
    method: 'post'
  })
}

// 获取我的门店分页
export function GetInvitStorePage(data) {
  return request({
    url: '/Store/GetInvitStorePage',
    method: 'post',
    data: data
  })
}
// 获取我的门店统计
export function GetInvitStoreTotal() {
  return request({
    url: '/Store/GetInvitStoreTotal',
    method: 'post'
  })
}
// 获取门店信息
export function GetInvitStoreInfo(params) {
  return request({
    url: '/Store/GetInvitStoreInfo',
    method: 'post',
    params: params
  })
}
// 获取门店语音播报设备
export function BindDeviceName(params) {
  return request({
    url: '/Store/BindDeviceName',
    method: 'post',
    params: params
  })
}
// 获取门店信息（通过cardNumber)
export function GetCashStoreInfo(params) {
  return request({
    url: '/Store/GetCashStoreInfo',
    method: 'post',
    params: params
  })
}

/**
 * 商品管理接口
 */
// 获取商品分类列表
export function GetStoreProductCategoryList() {
  return request({
    url: '/Store/GetStoreProductCategoryList',
    method: 'post'
  })
}
// 修改商品分类排序
export function UpdateStoreProductCategoryOrderBy(data) {
  return request({
    url: '/Store/UpdateStoreProductCategoryOrderBy',
    method: 'post',
    data: data
  })
}
// 修改商品分类
export function EditStoreProductCategory(data) {
  return request({
    url: '/Store/EditStoreProductCategory',
    method: 'post',
    data: data
  })
}
export function EditStoreProductCategoryByList(data) {
  return request({
    url: '/Store/EditStoreProductCategoryByList',
    method: 'post',
    data: data
  })
}
// 删除商品分类
export function DeleteStoreProductCategory(data) {
  return request({
    url: '/Store/DeleteStoreProductCategory',
    method: 'post',
    data: data
  })
}
// 获取商品列表
export function GetStoreProductList(data) {
  return request({
    url: '/Store/GetStoreProductList',
    method: 'post',
    data: data
  })
}
// 商品列表排序
export function UpdateStoreProductOrderBy(params) {
  return request({
    url: '/Store/UpdateStoreProductOrderBy',
    method: 'post',
    params: params
  })
}
// 商品列表排序(通过列表)
export function UpdateStoreProductOrderByByList(data) {
  return request({
    url: '/Store/UpdateStoreProductOrderByByList',
    method: 'post',
    data: data
  })
}
// 修改商品信息
export function EditStoreProduct(data) {
  return request({
    url: '/Store/EditStoreProduct',
    method: 'post',
    data: data
  })
}
// 删除商品
export function DeleteStoreProduct(params) {
  return request({
    url: '/Store/DeleteStoreProduct',
    method: 'post',
    params: params
  })
}
// 商品上下架
export function UpdateStoreProductStatu(params) {
  return request({
    url: '/Store/UpdateStoreProductStatu',
    method: 'post',
    params: params
  })
}
// 获取商品详情
export function GetStoreProductDetail(params) {
  return request({
    url: '/Store/GetStoreProductDetail',
    method: 'post',
    params: params
  })
}

// 获取邀请代理伙伴信息
export function GetInvitDealerConfigData() {
  return request({
    url: '/Store/GetInvitDealerConfigData',
    method: 'post'
  })
}
// 获取用户代理信息
export function GetUserStore() {
  return request({
    url: '/Store/GetUserStore',
    method: 'post'
  })
}
// 添加邀请代理伙伴信息
export function AddInvitDealer(params, data) {
  return request({
    url: '/Store/AddInvitDealer',
    method: 'post',
    params: params,
    data: data
  })
}

// 获取门店餐桌配置列表
export function GetStoreTableModeList(params) {
  return request({
    url: '/Store/GetStoreTableModeList',
    method: 'post',
    params: params
  })
}
// 增改门店餐桌配置
export function EditStoreTableMode(data) {
  return request({
    url: '/Store/EditStoreTableMode',
    method: 'post',
    data: data
  })
}
// 增改门店餐桌配置
export function EditStoreTableModeByList(params,data) {
  return request({
    url: '/Store/EditStoreTableModeByList',
    method: 'post',		
    params: params,
    data: data
  })
}
// 修改门店餐桌配置排序
export function UpdateStoreTableModeOrderBy(params,data) {
  return request({
    url: '/Store/UpdateStoreTableModeOrderBy',
    method: 'post',
		params: params,
    data: data
  })
}
// 删除门店餐桌配置
export function DeleteStoreTableMode(params) {
  return request({
    url: '/Store/DeleteStoreTableMode',
    method: 'post',
    params: params
  })
}
//获取门店桌号分页
export function GetStoreTablePage(data) {
  return request({
    url: '/Store/GetStoreTablePage',
    method: 'post',
    data: data
  })
}
//增改门店桌号
export function EditStoreTable(data) {
  return request({
    url: '/Store/EditStoreTable',
    method: 'post',
    data: data
  })
}
//更改门店桌号状态
export function UpdateStoreTableState(params) {
  return request({
    url: '/Store/UpdateStoreTableState',
    method: 'post',
    params: params
  })
}
//删除门店桌号配置
export function DeleteStoreTable(params) {
  return request({
    url: '/Store/DeleteStoreTable',
    method: 'post',
    params: params
  })
}
//获取门店桌号详情
export function GetStoreTableInfo(params) {
  return request({
    url: '/Store/GetStoreTableInfo',
    method: 'post',
		params: params
  })
}

//获取门店让利比例
export function GetStoreDiscountRatio(data) {
  return request({
    url: '/Store/GetStoreDiscountRatio',
    method: 'post',
		data: data
  })
}
//修改门店收银让利比例
export function UpdateStoreCashDiscountRatio(params) {
  return request({
    url: '/Store/UpdateStoreCashDiscountRatio',
    method: 'post',
		params: params
  })
}
